<script setup lang="ts">
import { Page } from '@vben/common-ui';
import { message } from 'ant-design-vue';

import { useVbenForm } from '#/adapter/form';
import { postMaliTest } from '#/api/admin/mail';
import { $t } from '@vben/locales';
const currentTab = ref(0);

const handleTest = async (values: any) => {
  const { msg } = await postMaliTest(values);
  message.success(msg);
};

const [TestForm] = useVbenForm({
  commonConfig: {
    componentProps: {
      class: 'w-full',
    },
  },
  handleSubmit: handleTest,
  layout: 'horizontal',
  schema: [
    {
      component: 'Input',
      componentProps: {
        placeholder: $t('page.common.Please Enter'),
      },
      fieldName: 'to',
      label: $t('admin.Recipient Email'),
      rules: 'required',
    },
    {
      component: 'Input',
      componentProps: {
        placeholder: $t('page.common.Please Enter'),
      },
      fieldName: 'subject',
      label: $t('page.common.Title'),
      rules: 'required',
    },
    {
      component: 'Editor',
      componentProps: {
        placeholder: $t('page.common.Please Enter'),
      },
      fieldName: 'content',
      label: $t('page.common.Content'),
      rules: 'required',
    },
  ],
});
</script>

<template>
  <Page>
    <TestForm />
  </Page>
</template>
